<?php

$user = $_POST['user'];
$ucpassword = $_POST['psswd'];
if (isset($user) && $user != "" && isset($ucpassword)) {
	$salt = substr ($user, 0, 2); /*Cut and take 2 words of the user*/
	$key_crypt = crypt ($ucpassword, $salt); /*Crypts and hash the password, phase 1*/
	$key_crypt = crypt ($ucpassword, $clave_crypt); /*Crypts more hash, phase 2. Security improvement strong*/
	
	/*Return values*/
	print('<div style="border: 12px solid #550;"><p>USER: <INPUT TYPE="TEXT" VALUE='.$user.' SIZE="60"></P>	</p>PASSWORD CRYPT IN DB: <INPUT TYPE="TEXT" VALUE='.$key_crypt.' SIZE="60"></P></div>');
}
else {
print("
<FORM ACTION='#' METHOD='POST'>

<center>
<P><LABEL>Username:</LABEL>
<INPUT TYPE='TEXT' NAME='user' SIZE='20'></P>

<P><LABEL>Password:</LABEL>
<INPUT TYPE='PASSWORD' NAME='psswd' SIZE='20'></P>

<P>
<INPUT TYPE='SUBMIT' VALUE='Crypt password'>
</P>
</center>

</FORM>
");

}